﻿using System;
using System.Collections.Generic;

using E.BLL;
using E.Model;
using E.Enum;
using E.Web.UI.Page;

using X.Common;
using X.Pager;
using X.Pager.List;

namespace E.Web.Teacher.sys.feedback
{
    public partial class List : TeacherBasePage
    {
        public string act;
        public string title;
        public string username;
        public string fromdate;
        public string todate;
        public IList<FeedBackModel> feedBackList;

        protected override void ShowPage()
        {
            FeedBackBLL bll = new FeedBackBLL();

            act = XRequest.GetString("act");
            title = XRequest.GetString("TitleTxt");
            username = XRequest.GetString("UserNameTxt");
            fromdate = XRequest.GetString("FromDateTxt");
            todate = XRequest.GetString("ToDateTxt");

            if (ispost || act == "s")
            {
                FeedBackModel searchModel = new FeedBackModel();
                searchModel.Title = title;
                searchModel.UserName = username;
                searchModel.FromDate = fromdate;
                searchModel.ToDate = todate;

                FeedBackListModel listModel = new FeedBackListModel();

                CheckPageIndexValue(XRequest.GetInt("s", 1) - 1, XRequest.GetInt("g", 0), XRequest.GetInt("z", customerPageSize));

                listModel = bll.GetFeedBackListByCondition(searchModel, customerPageSize, pageIndex);
                if (listModel.TotalCount > 0)
                {
                    count = listModel.TotalCount;
                    feedBackList = listModel.List;
                    PagerBase pager = new ListPager(count, pageIndex, currentPgGroup, customerPageSize, defaultPagesInGroup);

                    Dictionary<string, string> parms = new Dictionary<string, string>();
                    parms.Add("act", act);
                    parms.Add("TitleTxt", title);
                    parms.Add("UserNameTxt", username);
                    parms.Add("FromDateTxt", fromdate);
                    parms.Add("ToDateTxt", todate);
                    mypager = pager.DrawPager("selfpager", parms);
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}
